package threeD.Csg;

import twoD.Csg.Primitive;
import inf.jlinalg.IVector;

public class Box extends Primitive {
	private double ox, oy, oz;
	private double w, h, d;

	public Box(double ox, double oy, double oz, double w, double h, double d) {
		this.ox = ox;
		this.oy = oy;
		this.oz = oz;
		this.w = w;
		this.h = h;
		this.d = d;
	}

	@Override
	public boolean contain(double... p) {
		IVector phat = getInverseLocation(p);
		return (phat.get(0) >= ox - TOL) && ((phat.get(0) - ox) <= w + TOL)
				&& (phat.get(1) >= oy - TOL) && ((phat.get(1) - oy) <= h + TOL)
				&& (phat.get(2) >= oz - TOL) && ((phat.get(2) - oz) <= d + TOL);
	}
}
